package com.gexin.common.utils;

import com.gexin.model.activity.MemberBillShopLog;
import com.gexin.model.activity.MemberCoinLog;

import java.lang.reflect.Method;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class CollectionsSort implements Comparator{

    /**
     *
     * TODO 以对象Time判断两个list对象排序（可选）.
     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
     */
    @Override
    public int compare(Object arg0, Object arg1) {
        MemberCoinLog cb ;
        MemberBillShopLog rd ;
        MemberCoinLog cb1 ;
        MemberBillShopLog rd1 ;
        if(arg0 instanceof MemberCoinLog){
            cb=(MemberCoinLog)arg0;
            if(arg1 instanceof MemberBillShopLog){
                rd=(MemberBillShopLog)arg1;
                return cb.getCreateTime().compareTo(rd.getCreateTime());
            }else{
                cb1=(MemberCoinLog)arg1;
                return cb.getCreateTime().compareTo(cb1.getCreateTime());
            }
        }else{
            rd1=(MemberBillShopLog)arg0;
            if(arg1 instanceof MemberBillShopLog){
                rd=(MemberBillShopLog)arg1;
                return rd1.getCreateTime().compareTo(rd.getCreateTime());
            }else{
                cb=(MemberCoinLog)arg1;
                return rd1.getCreateTime().compareTo(cb.getCreateTime());
            }
        }
    }
}
